package top.ffhome.system.config.shiro;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.stereotype.Component;

import top.ffhome.common.config.BaseCurrentUser;
import top.ffhome.system.entity.SysUser;

@Component
@ConditionalOnMissingClass
public class CurrentUser implements BaseCurrentUser {
	@Override
	public Long getId() {
		try {
			return get().getId();
		} catch (Exception e) {
		}
		return 0L;
	}

	public SysUser get() {
		return (SysUser) ShiroUtil.getAttribute(BaseCurrentUser.CURRENT_USER);
	}
}
